/******************************************************************************

	COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2010.

	This file is part of Maxsi Engine.

	Maxsi Engine is free software: you can redistribute it and/or modify it
	under the terms of the GNU Lesser General Public License as published by
	the Free Software Foundation, either version 3 of the License, or (at your
	option) any later version.

	Maxsi Engine is distributed in the hope that it will be useful, but WITHOUT
	ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
	FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
	for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with Maxsi Engine. If not, see <http://www.gnu.org/licenses/>.

	MaxsiEngine.dll
	A general purpose C++ library for the Maxsi Technology Project.

	MaxsiWorker.h
	A multithreaded worker system where a thread pool executes jobs from a
	list of scheduled jobs and callbacks.

******************************************************************************/

#ifndef MaxsiWorker_H
#define MaxsiWorker_H

BeginMaxsiNamespace

typedef MaxsiError (*MaxsiWorkerCallback)(size_t ThreadID, BYTE* Parameter);

STRUCTLINK MaxsiWorkerJob
{
	MaxsiWorkerCallback		Function;
	BYTE*					Parameter;
};

LINK MaxsiError CreateWorkerThreadPool();
LINK MaxsiError DeleteWorkerThreadPool();

LINK Word_t MaxsiWorkerMainLoop(BYTE* Parameter);
LINK MaxsiError ScheduleWorkerThreadJob(MaxsiWorkerCallback Function, BYTE* Parameter);

LINK size_t GetNumWorkerThreads();
LINK size_t GetNumWorkerThreadsForNumCPUs(size_t NumCPUs);

EndMaxsiNamespace

#endif

